$(function(){
	
	if($('.car_use_type').val()==1){
		$('.pay_style').css('display','none');
	}else{
		$('.pay_style').css('display','block');
	};
	$('.car_use_type').on('change',function(){
		if($('.car_use_type').val()==1){
		$('.pay_style').css('display','none');
	}else{
		$('.pay_style').css('display','block');
	};
	})
	$('.keep').on('click',function(){
		var treeObj = $.fn.zTree.getZTreeObj("ztreeid");
		var nodes = treeObj.getNodes();
		console.log(nodes);
		var text = [];
		for(var i = 0; i < nodes.length; i++) {
		if(nodes[i].checked) {text.push(nodes[i].id)}
			if(nodes[i].children) {
				for(var j = 0; j < nodes[i].children.length; j++) {
					if(nodes[i].children[j].checked) {text.push(nodes[i].children[j].id)}
					if(nodes[i].children[j].children) {
						for(var z = 0; z < nodes[i].children[j].children.length; z++) {
							if(nodes[i].children[j].children[z].checked) {text.push(nodes[i].children[j].children[z].id)}
						}
					} 
				}
			} 
		}
		
		$('.prop').val(text)
		sendForm($(this),1); 
	});
	$('.back').on('click',function(){
		window.history.back()
	}); 
	var setting = {
		check: {
			enable: true,
			chkDisabledInherit: true
		},
		data: {
			simpleData: {
				enable: true
			}
		}
	};

	{if $props}
	var zNodes = {$props};
	console.log(zNodes)
	$.fn.zTree.init($("#ztreeid"), setting, zNodes);
	{/if}

})